import java.util.Scanner;

//计算字符串最后一个单词的个数
public class Test2 {
    //方法一
    public static int func(String s){
        int a = s.lastIndexOf(' ');
        return s.length()-a-1;
    }

    //方法二
    public static int func1(String s){
        for (int i = s.length()-1; i > 0; i--) {
            char ch = s.charAt(i);
            if(ch == ' '){
                return s.length()-i-1;
            }
        }
        return s.length();
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        System.out.println(func(s));
        System.out.println(func1(s));
    }
}
